<%@ include file="common.jsp" %>
	
	<style type="text/css">
	@import "./css/viewDetails.css";
	</style>

	<script type="text/javascript">
		$(document).ready(function(){
			bindEventsForDocDtlsPage();
		});
	</script>
<form:form name="searchDocForm" id="searchDocForm" commandName="documentSearchDetails">
	<input type="hidden" name="requestingPage" value="none" id="docLookupRequestingPage">
	<table class="zeroBorder">
		<tr class="formSpacingRow formBlockColor"><td colspan="12" class="formBlockColor"></td></tr>
	</table>
	<table class="viewDetails">
		<tr class="heading">
			<th colspan="12" align="center"> Available Filters</th>
		</tr>
		<tr class="formSpacingRow formBlockColor"><td colspan="12" class="formBlockColor"></td></tr>
		<tr class="even">
			<td><label>Name</label></td>
			<td><form:input path="documentName"/></td>
		
			<td><label>Code</label></td>
			<td><form:input path="docCode" /></td>	
			
			<td><label>Type</label></td>
			<td><form:select path="docTypeId" name="docID" id="docID">
					<form:option value="0"> ALL </form:option>
						<c:forEach items="${docTypeMap}" var="item">
							<form:option value="${item.key}">${item.value}</form:option>
						</c:forEach>
					</form:select>
			</td>
		
			<td><label>Category</label> </td>
			<td><form:select path="docCategoryId" name="docCategID" id="docCategID"></form:select></td>
		</tr>
		<tr class="odd formBlockColor">
			<td><label>Sub-Category</label> </td>
			<td><form:select path="docSubCategoryId" name="docSubCategID" id="docSubCategID"></form:select></td>
		
			<td>Business Unit</td>		<!-- changed from location to business unit on 25-02-2012 as told by shubh -->
			<td>
				<form:select path="location" id="locselectfordoc" name="location" onchange="loadDepttForBU(this.id,'departmentfordoc')">						
				<option value="0">All</option>
					<c:forEach items="${locationList}" var="item">
						<form:option value="${item.key}">${item.value}</form:option>
					</c:forEach>
				</form:select>
			</td>
		
			<td>Department</td>
			<td>
				<form:select path="department" id="departmentfordoc" name="department" >
						<form:option value="0">All</form:option>
					<c:forEach items="${deptList}" var="item">
						<form:option value="${item.key}">${item.value}</form:option>
					</c:forEach>
				</form:select>
			</td>
			
				<td>Document Status</td>
				<td>
					<form:select path="documentStatus">
						<%-- <form:option value="All">All</form:option> --%>
						<sec:authorize access="hasAnyRole('ROLE_CCC','ROLE_CC')">
							<c:forEach items="${docStatusMap}" var="item">
								<form:option value="${item.key}">${item.value}</form:option>
							</c:forEach>
						</sec:authorize>
					</form:select>
				</td>
			
		</tr>
		
		<tr class="even">	
			<td colspan="12">
				<input type="button" value="Search" class="formButton" onclick="showListOfAvailableDocuments();">&nbsp;&nbsp;
				<input type="button" value="Cancel" class="formButton" onclick="closeDocumentLookupDialog();">
			</td>
		</tr>
	</table>
</form:form>
<div id="documentLookUpTable"></div>